"""
使用超级鹰平台破解验证码
"""
import requests
from hashlib import md5

resp1 = requests.get('https://cas.1000phone.net/cas/capcha')
data = resp1.content
with open('res/captcha.jpg', 'wb') as file:
    file.write(data)
resp2 = requests.post(
    url='http://upload.chaojiying.net/Upload/Processing.php',
    data={
        # 验证码类型
        'codetype': 1902,
        # 登录超级鹰平台的用户名
        'user': 'jackfrued',
        # 登录超级鹰平台的用户密码（MD5摘要）
        'pass2': md5('Lovejack'.encode()).hexdigest(),
        # 用户中心生成的软件ID
        'softid': '900260',
    },
    files={
        'userfile': ('captcha.jpg', data)
    },
    headers={
        'Connection': 'Keep-Alive',
        'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
    },
)
result = resp2.json()
print(result)
if result['err_no'] == 0:
    print(result['pic_str'])
